package cn.basic.social.manager.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * @ClassName AuthAutoConfiguration
 * @Description 自动配置类
 * @Author zlf
 * @Date 2023/9/1 16:21
 */
@Slf4j
@Configuration
@EnableConfigurationProperties(SocialConfigProperties.class)
public class SocialAutoConfiguration {

    @Bean
    @ConditionalOnProperty(prefix = "social.config", value = "enabled", havingValue = "true", matchIfMissing = false)
    public SocialRequestFactory socialRequestFactory(SocialConfigProperties socialConfigProperties, RedisCache redisCache) {
        return new SocialRequestFactory(socialConfigProperties, redisCache);
    }

    @Configuration
    @Import({RedisConfig.Redis.class})
    protected static class RedisCacheAutoConfiguration {

    }

}
